package hu.veilingsite.client;

import hu.veilingsite.shared.ClientUser;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
//klasse systeem zorgt voor de controle over de clientside code

public class Systeem {
	public static ClientUser ingelogd;

	public Systeem(){
	}

	//deze methode maakt alle menu buttons aan.
	public static void createMenu() {
		RootPanel menu = RootPanel.get("links");
		menu.clear();
		menu.add(new HTML("<a href=\"#home\">Home</a>"));
		menu.add(new HTML("<a href=\"#veilingen\">Alle veilingen</a>"));
		if(ingelogd == null) {
			menu.add(new HTML("<a href=\"#registreer\">Registeren</a>"));
			menu.add(new HTML("<a href=\"#login\">Inloggen</a>"));
		} else {
			if(ingelogd.isIsadmin()) {
				menu.add(new HTML("<a href=\"#categories\">Categories</a>"));
				menu.add(new HTML("<a href=\"#statistics\">Statestieken</a>"));
			}
			menu.add(new HTML("<a href=\"#profile\">Profiel</a>"));
			menu.add(new HTML("<a href=\"#credits\">Credits</a>"));
			menu.add(new HTML("<a href=\"#logout\">Uitloggen</a>"));
		}
	}
	
	public static void uitloggen(){
		ingelogd = null;
		createMenu();
		RootPanel.get("accountinfo").clear();
	}
}